<form autocomplete="off" onsubmit="return false;" action="{:request()->url()}" data-auto="true" method="post"
      id="ProductForm" class='form-horizontal layui-form padding-top-20'>

    <div class="form-group">
        <label class="col-sm-2 control-label">作品</label>
        <div class='col-sm-8'>
            <span disabled class="layui-input" style="background-color: #e1e1e1">
                <img class="headimg_com" src="{$vo.startpicurl}" title="" style="">
                {$vo.item}（ID：{$vo.id}）
            </span>
        </div>
    </div>

    <div class="form-group">
        <label class="col-sm-2 control-label">不通过理由</label>
        <div class="col-md-8">
            <textarea name="checkinfo" required class="layui-textarea" id="test" style="height:80px;"></textarea>
        </div>
    </div>
    <div class="form-group">
        <label class="col-sm-2 control-label">常用理由</label>
        <div class="col-sm-8" style="margin-top: 6px">
            {foreach $message_list as $one}
            <span class="layui-badge btnI" data-name="{$one.message}" style="margin-bottom:3px;cursor:pointer">{$one.message}</span>
            {/foreach}
        </div>
    </div>
    <div class="hr-line-dashed"></div>

    <div class="col-sm-7 col-sm-offset-2">
        <div class="layui-form-item text-center">
            {if !empty($vo.id)}<input type="hidden" name="id" value="{$vo.id}">{/if}
            <button class="layui-btn" type="submit">提交</button>
        </div>
    </div>
</form>


        <button class="layui-btn layui-btn-xs" lay-event="edit" onclick="add()">
            <i class="layui-icon layui-icon-edit"></i>添加常用理由<i class="iconfont"></i>
            <!--<button>小型按钮</button>-->
        </button>


<style>
    .headimg_com {
        width: 20px;
        height: 20px;
        border-radius: 80%;
        margin-right: 10px;
    }

</style>

<script type="text/javascript">

    function add() {
        layer.open({
            //formType: 2,//这里依然指定类型是多行文本框，但是在下面content中也可绑定多行文本框
            title: '添加常用理由?',
            area: ['300px', '240px'],
            btnAlign: 'c',
            closeBtn: '1',//右上角的关闭
            content: '<div><p>请输入常用理由:</p><textarea name="txt_remark" id="remark" style="width:200px;height:80px;"></textarea></div>',
            btn: ['确认', '取消'],
            yes: function (index, layero) {
                var value1 = $('#remark').val();//获取多行文本框的值
//                alert('您刚才输入了:' + value1);

                $.ajax({
                    type: "POST",
                    dataType: 'json',
                    url: "{:url('admin/info/add_message')}",
                    data: {
                        message: value1
                    },
                    success: function (data) {
                        if (data.code == 0) {
                            layer.close(index);
                            layer.open({content: data.message, btn: '我知道了'});

                        } else {
                            layer.close(index);
                            layer.open({content: data.message, btn: '我知道了'});
                        }

                    }
                });

                layer.close(index);
            }
        });

    }

    $(document).ready(function () {
        $(".btnI").click(function () {
            var data = $(this).data("name");
            var text = $("#test").val(" ");
            $("#test").val(data);
        });
    });
</script>